let http = require('http');

let server = http.createServer();

server.on('request',(req,res) => {
    console.log(req.url);
    let url = req.url;
    res.setHeader('Content-type','text/html;charset=utf-8');
    if(url == '/login') {
        res.end('你发起了登录的请求...');
    }else if(url == '/register') {
        res.end('你发起了注册的请求...');
    }else if(url == '/home') {
        res.end('你发起了首页的请求...');
    }else {
        res.end('<h1>404</h1>');
    }
    
})

server.listen(8888,()=>{
    console.log('服务器运行在http://localhost:8888上')
});